---
title: 常用正则
date: '2023-04-01 12:12:12'
tags: ['正则']
draft: false
summary: 验证手机号 ` javascript const rule = /^(1[34578]\d{9})$/ ` 验证手机或座机 ` javascript const rule = /^(([1-9]{1}[0-9]{5,8})|(1[34578]\d{9}))$/ `
---

- 验证手机号

```javascript
const rule = /^(1[34578]\d{9})$/
```

- 验证手机或座机

```javascript
const rule = /^(([1-9]{1}[0-9]{5,8})|(1[34578]\d{9}))$/
```
